package com.jxy.edu.manage_course.dao;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.jxy.edu.domain.course.CourseBase;
import com.jxy.edu.domain.course.ext.CourseInfo;
import com.jxy.edu.domain.course.request.CourseListRequest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

/**
 * @author lumi
 * @date 2020/2/12 0:16
 */
@SpringBootTest
@RunWith(SpringRunner.class)
public class testPageHelper {

    @Autowired
    CourseMapper courseMapper;
    @Test
    public void testPageHelper(){
        PageHelper.startPage(1, 11);
        CourseListRequest courseListRequest = new CourseListRequest();
        courseListRequest.setCompanyId("1");
        Page<CourseInfo> courseListPage = courseMapper.findCourseListPage(courseListRequest);
        List<CourseInfo> result = courseListPage.getResult();
        System.out.println(courseListPage);
    }
    @Test
    public void testFindcoursrBase(){
        PageHelper.startPage(1, 11);
        CourseListRequest courseListRequest = new CourseListRequest();
        Page<CourseBase> courseListPage = courseMapper.findCourseList();
        List<CourseBase> result = courseListPage.getResult();
        System.out.println(courseListPage);
    }

}
